var userTypeId = 0;
var user;
var communityId = "";
/*function getUrl(url, params) {
    for (var i = 0; i < params.length; i++) {
        if ($("#" + params[i]).val() != "") {
            url = url + "&" + params[i] + "=" + $("#" + params[i]).val();
        }
    }
    return url;

}*/

$(document).ready(function () {
    $.ajax({
        url: '/commis/api/user/currentUser',
        type: "GET",
        async: false,
        dataType: 'json',
        data: {},
        success: function (response) {
            if (response.status == 0) {
                console.log("用户存在");
                user = response.data;
                userTypeId = user.userTypeId;
                communityId = user.communityId;

                console.log(userTypeId);
            } else if (response.status == 1) {
                alert("登录用户已经过期，请重新登录");
                window.parent.location.href = "../../login.html";
            }
        }, error: function (msg) {
            alert("登录用户已经过期，请重新登录");
            window.parent.location.href = "../../login.html";
        }
    })

    var type = getUrlParam("type");
    console.log(type);


    if (type == 0) {
        $("#backDiv").show();
        $('#backTable').DataTable({

            ajax: "/commis/api/backNotify/pageDatatables",
            autoWidth: true,
            responsive: true,

            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    },
                    columns: "选中 %d 列"
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'type_name',
                    render: function (data, type, row) {
                        if(data=="fund"){
                            return "公益金";
                        }else if(data=="officeSupplies"){
                            return "办公经费";
                        }else if(data=="publicFund"){
                            return "服务群众经费";
                        } else if(data=="construction"){
                            return "党务经费";
                        }else{
                            return "无";
                        }






                    }
                },
                {
                    data: 'project_name', defaultContent: ""
                }, {
                    data: 'flag',
                    render: function (data, type, row) {
                        // Combine the first and last names into a single table field
                        if (3 == data) {
                            return "建议";
                        }else if (2 == data){
                            return "不同意"
                        }
                    }

                }, {
                    data: 'id',
                    render: function (data, type, row) {

                        if(row.type_name=="fund"){

                            return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="fundDetail.html?delete=1&backid=' + row.id+ '&id=' + row.project_id + '" class="btn btn-primary btn-xs" title="查看详情">查看详情</a></li></ul> </div>';


                        }else if(row.type_name=="officeSupplies"){

                            return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="officeSuppliesDetail.html?delete=1&backid=' + row.id+ '&id=' + row.project_id + '" class="btn btn-primary btn-xs" title="查看详情">查看详情</a></li></ul> </div>';


                        }else if(row.type_name=="publicFund"){

                            return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="publicFundDetail.html?delete=1&backid=' + row.id+ '&id=' + row.project_id + '" class="btn btn-primary btn-xs" title="查看详情">查看详情</a></li></ul> </div>';


                        }
                        else if(row.type_name=="construction"){

                            return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="constructionDetail.html?delete=1&backid=' + row.id+ '&id=' + row.project_id + '" class="btn btn-primary btn-xs" title="查看详情">查看详情</a></li></ul> </div>';


                        }else {

                            return '无';


                        }





                    }
                }
            ]

        });

    }
    else if (type == 1) {
        $("#addProDiv").show();
        var editor = new $.fn.dataTable.Editor({
            ajax: {
                edit: {
                    type: 'PUT',
                    url: '/commis/api/property/edit?id=_id_'
                },
                remove: {
                    type: 'DELETE',
                    url: '/commis/api/property/remove?id=_id_'
                }
            },
            i18n: {
                create: {
                    title: "申报记录",
                    submit: "确定"
                },
                edit: {
                    title: "审核资产",
                    submit: "确定",
                    confirm: "您确定要修改这 %d 条记录吗?"
                },
                remove: {
                    title: "删除记录",
                    submit: "删除",
                    confirm: "您确定要删除这 %d 条记录吗?"
                }
            },
            idSrc: 'propertyId',
            table: "#addPropertyTable",
            fields: [
                {
                    label: "是否同意:",
                    name: "addAuditState",
                    type: "radio",
                    options: [
                        {
                            label: "同意",
                            value: "1"
                        }, {
                            label: "不同意",
                            value: "2"
                        }
                    ]
                }]
        });
        editor.on('submitSuccess', function (e, d, action) {

            $.ajax({
                url: '/commis/api/index/notify',
                type: "GET",
                async: false,
                dataType: 'json',
                success: function (result) {
                    if (result.status == 0) {
                        countNotify(result);
                    }


                }, error: function (msg) {
                    alert("发生错误");
                }
            })


        });
        $('#addPropertyTable').DataTable({

            dom: "Bfrtip",
            ajax: "/commis/api/property/pageDatatables?propertyState=0",
            autoWidth: true,
            responsive: true,

            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            createdRow: function (row, data, index) {
                if (data["propertyState"] == 0 || data["propertyState"] == 2) {

                    // $('td', row).eq(3).css('font-weight', "bold").css("color", "red");
                    $('td', row).css('backgroundColor', '#f8c4c4');
                }

            },
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    },
                    columns: "选中 %d 列"
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community.communityName', defaultContent: ""
                },
                {
                    data: 'propertyCode', defaultContent: ""
                }, {
                    data: 'propertyName', defaultContent: ""

                }, {
                    data: 'propertyState',
                    render: function (data, type, row) {
                        // Combine the first and last names into a single table field
                        if (0 == data) {
                            return "待审批";
                        } else if (1 == data) {
                            return "在用"
                        } else if (2 == data) {
                            return "待报废"
                        } else {
                            return "报废"
                        }
                    }
                }, {
                    data: 'deployTime', defaultContent: ""
                }, {
                    data: 'propertyBrand', defaultContent: ""
                }, {
                    data: 'specificationType', defaultContent: ""
                }, {
                    data: 'serialNumber', defaultContent: ""
                }, {
                    data: 'count', defaultContent: ""
                }, {
                    data: 'configurationUnit', defaultContent: ""
                }, {
                    data: 'propertyAdd', defaultContent: ""
                }, {
                    data: 'useStatus', defaultContent: ""
                }, {
                    data: 'remarks', defaultContent: ""
                }, {
                    data: 'propertyType.typeName', defaultContent: ""
                }
            ],
            select: true,
            buttons: [
                {extend: "edit", editor: editor, text: "审核", className: 'btn btn-primary'},
                {extend: "remove", editor: editor, text: "删除", className: 'btn btn-danger'}
            ]

        });

    } else if (type == 2) {
        $("#delProDiv").show();
        var editor2 = new $.fn.dataTable.Editor({
            ajax: {
                edit: {
                    type: 'PUT',
                    url: '/commis/api/property/edit?id=_id_'
                },
                remove: {
                    type: 'DELETE',
                    url: '/commis/api/property/remove?id=_id_'
                }
            },
            i18n: {
                create: {
                    title: "新增记录",
                    submit: "添加"
                },
                edit: {
                    title: "修改记录",
                    submit: "修改",
                    confirm: "您确定要修改这 %d 条记录吗?"
                },
                remove: {
                    title: "删除记录",
                    submit: "删除",
                    confirm: "您确定要删除这 %d 条记录吗?"
                }
            },
            idSrc: 'propertyId',
            table: "#delPropertyTable",
            fields: [
                {
                    label: "是否同意:",
                    name: "delAuditState",
                    type: "radio",
                    options: [
                        {
                            label: "同意",
                            value: "1"
                        }, {
                            label: "不同意",
                            value: "2"
                        }
                    ]
                }]
        });
        editor2.on('submitSuccess', function (e, d, action) {

            $.ajax({
                url: '/commis/api/index/notify',
                type: "GET",
                async: false,
                dataType: 'json',
                success: function (result) {
                    if (result.status == 0) {

                        countNotify(result);
                    }


                }, error: function (msg) {
                    alert("发生错误");
                }
            })


        });
        $('#delPropertyTable').DataTable({

            dom: "Bfrtip",
            ajax: "/commis/api/property/pageDatatables?propertyState=2",
            autoWidth: true,
            responsive: true,

            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            createdRow: function (row, data, index) {
                if (data["propertyState"] == 0 || data["propertyState"] == 2) {
                    // $('td', row).css("color","red");
                    // $('td', row).css('backgroundColor','#FF0000')
                    // $('td', row).eq(3).css('font-weight', "bold").css("color", "red");
                    $('td', row).css('backgroundColor', '#f8c4c4');
                }
            },
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    },
                    columns: "选中 %d 列"
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community.communityName', defaultContent: ""
                },
                {
                    data: 'propertyCode', defaultContent: ""
                }, {
                    data: 'propertyName', defaultContent: ""

                }, {
                    data: 'propertyState',
                    render: function (data, type, row) {
                        // Combine the first and last names into a single table field
                        if (0 == data) {
                            return "待审批";
                        } else if (1 == data) {
                            return "在用"
                        } else if (2 == data) {
                            return "待报废"
                        } else {
                            return "报废"
                        }
                    }
                }, {
                    data: 'deployTime', defaultContent: ""
                }, {
                    data: 'propertyBrand', defaultContent: ""
                }, {
                    data: 'specificationType', defaultContent: ""
                }, {
                    data: 'serialNumber', defaultContent: ""
                }, {
                    data: 'count', defaultContent: ""
                }, {
                    data: 'configurationUnit', defaultContent: ""
                }, {
                    data: 'propertyAdd', defaultContent: ""
                }, {
                    data: 'useStatus', defaultContent: ""
                }, {
                    data: 'remarks', defaultContent: ""
                }, {
                    data: 'propertyType.typeName', defaultContent: ""
                }
            ],
            select: true,
            buttons: [
                {extend: "edit", editor: editor2, text: "审核", className: 'btn btn-primary'},
                {extend: "remove", editor: editor2, text: "删除", className: 'btn btn-danger'}
            ]

        });

    } else if (type == 3) {
        $("#fundDiv").show();
        var editor3 = new $.fn.dataTable.Editor({
            ajax: {
                edit: {
                    type: 'PUT',
                    url: '/commis/api/fund/fundEdit?id=_id_'
                },
                remove: {
                    type: 'DELETE',
                    url: '/commis/api/fund/remove?id=_id_'
                }
            },
            i18n: {
                edit: {
                    title: "审批公益金",
                    submit: "确定",
                    confirm: "您确定要修改这 %d 条记录吗?"
                },
                remove: {
                    title: "删除记录",
                    submit: "删除",
                    confirm: "您确定要删除这 %d 条记录吗?"
                }
            },
            idSrc: 'pp_change_id',
            table: "#fundTable",
            fields: [
                {
                    label: "是否同意:",
                    name: "currentState",
                    type: "radio",
                    options: [
                        {
                            label: "同意",
                            value: "1"
                        }, {
                            label: "不同意",
                            value: "2"
                        }, {
                            label: "建议",
                            value: "3"
                        }
                    ],
                    def: "1"
                }, {
                    label: "建议:",
                    name: "suggest",
                    type: "textarea",

                }, {
                    label: "金额:",
                    name: "amount"

                }]
        });
        editor3.on('submitSuccess', function (e, d, action) {

            $.ajax({
                url: '/commis/api/index/notify',
                type: "GET",
                async: false,
                dataType: 'json',
                success: function (result) {
                    if (result.status == 0) {

                        countNotify(result);
                    }


                }, error: function (msg) {
                    alert("发生错误");
                }
            })


        });
        editor3.dependent('currentState', function (val) {
            return val === '3' ?
                {show: ['suggest','amount']} :
                {hide: ['suggest','amount']};
        });
        $('#fundTable').DataTable({
            dom: "Bfrtip",
            ajax: "/commis/api/fund/fundNotify",

            autoWidth: true,
            responsive: true,
            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    }/*,
                     columns: "选中 %d 列"*/
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community_name', defaultContent: ""
                }, {
                    data: 'pp_id',
                    render: function (data, type, row) {
                        return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="fundDetail.html?id=' + data + '" class="btn btn-primary btn-xs" title="项目详情">项目详情</a></li></ul> </div>';
                    }
                },
                 {
                    data: 'is_off',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/fund/download/' + row.pp_id + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/fund/download/' + row.pp_id+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                },/*{
                 data: 'depart.departName', defaultContent: ""
                 },*/ {
                    data: 'person_name', defaultContent: ""
                }, {
                    data: 'register_time', defaultContent: ""
                }, {
                    data: 'pp_name', defaultContent: ""

                }, {
                    data: 'amount', defaultContent: ""
                }, {
                    data: 'is_off',
                    render: function (data, type, row) {
                        if (1 == data) {
                            return "是";
                        } else {
                            return "否"
                        }
                    }
                }], select: true,
            buttons: [
                {extend: "edit", editor: editor3, text: "审核", className: 'btn btn-primary'}
            ]

        });

    } else if (type == 4) {
        $("#officeDiv").show();
        var editor4 = new $.fn.dataTable.Editor({
            ajax: {
                edit: {
                    type: 'PUT',
                    url: '/commis/api/officeSupplies/officeSuppliesEdit?id=_id_'
                },
                remove: {
                    type: 'DELETE',
                    url: '/commis/api/officeSupplies/remove?id=_id_'
                }
            },
            i18n: {
                create: {
                    title: "新增记录",
                    submit: "添加"
                },
                edit: {
                    title: "审批办公经费",
                    submit: "修改",
                    confirm: "您确定要修改这 %d 条记录吗?"
                },
                remove: {
                    title: "删除记录",
                    submit: "删除",
                    confirm: "您确定要删除这 %d 条记录吗?"
                }
            },
            idSrc: 'change_id',
            table: "#officeTable",
            fields: [
                {
                    label: "是否同意:",
                    name: "currentState",
                    type: "radio",
                    options: [
                        {
                            label: "同意",
                            value: "1"
                        }, {
                            label: "不同意",
                            value: "2"
                        }, {
                            label: "建议",
                            value: "3"
                        }
                    ],
                    def: "1"
                }, {
                    label: "建议:",
                    name: "suggest",
                    type: "textarea",

                }, {
                    label: "金额:",
                    name: "amount"

                }]
        });
        editor4.on('submitSuccess', function (e, d, action) {

            $.ajax({
                url: '/commis/api/index/notify',
                type: "GET",
                async: false,
                dataType: 'json',
                success: function (result) {
                    if (result.status == 0) {

                        countNotify(result);
                    }


                }, error: function (msg) {
                    alert("发生错误");
                }
            })


        });
        editor4.dependent('currentState', function (val) {
            return val === '3' ?
                {show: ['suggest','amount']} :
                {hide: ['suggest','amount']};
        });
        $('#officeTable').DataTable({
            dom: "Bfrtip",
            ajax: "/commis/api/officeSupplies/officeSuppliesNotify",

            autoWidth: true,
            responsive: true,
            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    }/*,
                     columns: "选中 %d 列"*/
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community_name', defaultContent: ""
                }, {
                    data: 'supplies_id',
                    render: function (data, type, row) {
                        return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="officeSuppliesDetail.html?id=' + data + '" class="btn btn-primary btn-xs" title="经费详情">经费详情</a></li></ul> </div>';
                    }
                }, {
                    data: 'is_off',
                    render: function (data, type, row) {
                        if(data==1){
                            return '<a href="api/officeSupplies/download/' + row.supplies_id + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/officeSupplies/download/' + row.supplies_id+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'person_name', defaultContent: ""
                }, {
                    data: 'register_time', defaultContent: ""
                }, {
                    data: 'workexp_type', defaultContent: ""
                }, {
                    data: 'sum', defaultContent: ""
                }, /*{
                 data: 'liveAddr', defaultContent: ""
                 },*/ {
                    data: 'payment_mode', defaultContent: ""
                }, {
                    data: 'comment', defaultContent: ""
                }, {
                    data: 'is_off',
                    render: function (data, type, row) {
                        if (1 == data) {
                            return "是";
                        } else {
                            return "否"
                        }
                    }
                }], select: true,
            buttons: [
                {extend: "edit", editor: editor4, text: "审核", className: 'btn btn-primary'}
            ]

        });

    }else if (type == 5) {
        $("#publicFundDiv").show();
        var editor = new $.fn.dataTable.Editor({
            ajax: {
                edit: {
                    type: 'PUT',
                    url: '/commis/api/publicFund/publicFundEdit?id=_id_'
                },
                remove: {
                    type: 'DELETE',
                    url: '/commis/api/publicFund/remove?id=_id_'
                }
            },
            i18n: {
                edit: {
                    title: "审批群众经费",
                    submit: "确定",
                    confirm: "您确定要修改这 %d 条记录吗?"
                },
                remove: {
                    title: "删除记录",
                    submit: "删除",
                    confirm: "您确定要删除这 %d 条记录吗?"
                }
            },
            idSrc: 'pf_change_id',
            table: "#publicFundTable",
            fields: [
                {
                    label: "是否同意:",
                    name: "currentState",
                    type: "radio",
                    options: [
                        {
                            label: "同意",
                            value: "1"
                        }, {
                            label: "不同意",
                            value: "2"
                        }, {
                            label: "建议",
                            value: "3"
                        }
                    ],
                    def: "1"
                }, {
                    label: "建议:",
                    name: "suggest",
                    type: "textarea",

                }]
        });
        editor.on('submitSuccess', function (e, d, action) {

            $.ajax({
                url: '/commis/api/index/notify',
                type: "GET",
                async: false,
                dataType: 'json',
                success: function (result) {
                    if (result.status == 0) {

                        countNotify(result);
                    }


                }, error: function (msg) {
                    alert("发生错误");
                }
            })


        });
        editor.dependent('currentState', function (val) {
            return val === '3' ?
                {show: ['suggest']} :
                {hide: ['suggest']};
        });
        $('#publicFundTable').DataTable({

            dom: "Bfrtip",
            ajax: "/commis/api/publicFund/publicFundNotify",
            autoWidth: true,
            responsive: true,

            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    },
                    columns: "选中 %d 列"
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community_name', defaultContent: ""
                }, {
                    data: 'pf_id',
                    render: function (data, type, row) {
                        return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="publicFundDetail.html?id=' + data + '" class="btn btn-primary btn-xs" title="群众经费详情">群众经费详情</a></li></ul> </div>';
                    }
                }, {
                    data: 'is_off',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/publicFund/btDownload?filepath1=' + row.attachpath1 + '&filepath2=' + row.attachpath2 + '&filepath3=' + row.attachpath3+'" class="btn btn-primary btn-xs" >打包下载</a>';

                        }else{
                            return '<a href="api/publicFund/btDownload?filepath1=' + row.attachpath1 + '&filepath2=' + row.attachpath2 + '&filepath3=' + row.attachpath3+'" class="btn btn-primary btn-xs" >打包下载</a>';

                        }
                    }
                }, /*{
                 data: 'depart.departName', defaultContent: ""
                 },*/ {
                    data: 'person_name', defaultContent: ""
                }, {
                    data: 'register_time', defaultContent: ""
                }, {
                    data: 'pf_title', defaultContent: ""

                }, {
                    data: 'pf_time', defaultContent: ""
                }, {
                    data: 'attachpath1',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/publicFund/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/publicFund/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'attachpath2',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/publicFund/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/publicFund/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'attachpath3',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/publicFund/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/publicFund/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'isOff',
                    render: function (data, type, row) {
                        if (1 == data) {
                            return "是";
                        } else {
                            return "否"
                        }
                    }
                }],
            select: true,
            buttons: [
                {extend: "edit", editor: editor, text: "审核", className: 'btn btn-primary'}
            ]

        });

    }  else if (type == 6) {
        $("#constructionDiv").show();
        var editor = new $.fn.dataTable.Editor({
            ajax: {
                edit: {
                    type: 'PUT',
                    url: '/commis/api/construction/constructionEdit?id=_id_'
                },
                remove: {
                    type: 'DELETE',
                    url: '/commis/api/construction/remove?id=_id_'
                }
            },
            i18n: {
                edit: {
                    title: "审批群众经费",
                    submit: "确定",
                    confirm: "您确定要修改这 %d 条记录吗?"
                },
                remove: {
                    title: "删除记录",
                    submit: "删除",
                    confirm: "您确定要删除这 %d 条记录吗?"
                }
            },
            idSrc: 'con_change_id',
            table: "#constructionTable",
            fields: [
                {
                    label: "是否同意:",
                    name: "currentState",
                    type: "radio",
                    options: [
                        {
                            label: "同意",
                            value: "1"
                        }, {
                            label: "不同意",
                            value: "2"
                        }, {
                            label: "建议",
                            value: "3"
                        }
                    ],
                    def: "1"
                }, {
                    label: "建议:",
                    name: "suggest",
                    type: "textarea",

                }]
        });
        editor.on('submitSuccess', function (e, d, action) {

            $.ajax({
                url: '/commis/api/index/notify',
                type: "GET",
                async: false,
                dataType: 'json',
                success: function (result) {
                    if (result.status == 0) {

                        countNotify(result);
                    }


                }, error: function (msg) {
                    alert("发生错误");
                }
            })


        });
        editor.dependent('currentState', function (val) {
            return val === '3' ?
                {show: ['suggest']} :
                {hide: ['suggest']};
        });
        $('#constructionTable').DataTable({

            dom: "Bfrtip",
            ajax: "/commis/api/construction/constructionNotify",
            autoWidth: true,
            responsive: true,

            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    },
                    columns: "选中 %d 列"
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community_name', defaultContent: ""
                }, {
                    data: 'con_id',
                    render: function (data, type, row) {
                        return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="constructionDetail.html?id=' + data + '" class="btn btn-primary btn-xs" title="群众经费详情">党建经费详情</a></li></ul> </div>';
                    }
                }, {
                    data: 'is_off',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/construction/btDownload?filepath1=' + row.attachpath1 + '&filepath2=' + row.attachpath2 + '&filepath3=' + row.attachpath3+'" class="btn btn-primary btn-xs" >打包下载</a>';

                        }else{
                            return '<a href="api/construction/btDownload?filepath1=' + row.attachpath1 + '&filepath2=' + row.attachpath2 + '&filepath3=' + row.attachpath3+'" class="btn btn-primary btn-xs" >打包下载</a>';

                        }
                    }
                }, /*{
                 data: 'depart.departName', defaultContent: ""
                 },*/ {
                    data: 'person_name', defaultContent: ""
                }, {
                    data: 'register_time', defaultContent: ""
                }, {
                    data: 'con_title', defaultContent: ""

                }, {
                    data: 'con_time', defaultContent: ""
                }, {
                    data: 'attachpath1',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/construction/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/construction/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'attachpath2',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/construction/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/construction/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'attachpath3',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/construction/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/construction/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'isOff',
                    render: function (data, type, row) {
                        if (1 == data) {
                            return "是";
                        } else {
                            return "否"
                        }
                    }
                }],
            select: true,
            buttons: [
                {extend: "edit", editor: editor, text: "审核", className: 'btn btn-primary'}
            ]

        });

    } else if (type == 7) {
        $("#fundComDiv").show();
        var editor = new $.fn.dataTable.Editor({
            ajax: {
                edit: {
                    type: 'PUT',
                    url: '/commis/api/fund/fundComEdit?id=_id_'
                },
                remove: {
                    type: 'DELETE',
                    url: '/commis/api/fund/remove?id=_id_'
                }
            },
            i18n: {
                edit: {
                    title: "审批公益金",
                    submit: "确定",
                    confirm: "您确定要修改这 %d 条记录吗?"
                },
                remove: {
                    title: "删除记录",
                    submit: "删除",
                    confirm: "您确定要删除这 %d 条记录吗?"
                }
            },
            idSrc: 'pp_id',
            table: "#fundComTable",
            fields: [
                {
                    label: "是否完成:",
                    name: "is_off"

                }]
        });
        editor.on('submitSuccess', function (e, d, action) {

            $.ajax({
                url: '/commis/api/index/notify',
                type: "GET",
                async: false,
                dataType: 'json',
                success: function (result) {
                    if (result.status == 0) {

                        countNotify(result);
                    }


                }, error: function (msg) {
                    alert("发生错误");
                }
            })


        });
        var table = $('#fundComTable').DataTable({
            dom: "Bfrtip",
            ajax: "/commis/api/fund/fundComNotify?isOff=7",

            autoWidth: true,
            responsive: true,
            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    }/*,
                     columns: "选中 %d 列"*/
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community_name', defaultContent: ""
                }, {
                    data: 'pp_id',
                    render: function (data, type, row) {
                        return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="fundDetail.html?id=' + data + '" class="btn btn-primary btn-xs" title="项目详情">项目详情</a></li></ul> </div>';
                    }
                }, /*{
                 data: 'depart.departName', defaultContent: ""
                 },*/ {
                    data: 'person_name', defaultContent: ""
                }, {
                    data: 'register_time', defaultContent: ""
                }, {
                    data: 'pp_name', defaultContent: ""

                }, {
                    data: 'pp_date', defaultContent: ""
                }, {
                    data: 'pp_add', defaultContent: ""
                }, {
                    data: 'people', defaultContent: ""
                }, {
                    data: 'pp_detail', defaultContent: ""
                }, /*{
                 data: 'liveAddr', defaultContent: ""
                 },*/ {
                    data: 'amount', defaultContent: ""
                }, {
                    data: 'events_org', defaultContent: ""
                }, {
                    data: 'budger', defaultContent: ""
                }, {
                    data: 'is_off',
                    render: function (data, type, row) {
                        if (1 == data) {
                            return "是";
                        } else {
                            return "否"
                        }
                    }
                }], select: true,
            buttons: [
                {
                    extend: "selectedSingle",
                    text: "确定",
                    className: 'btn btn-primary',
                    action: function ( e, dt, node, config ) {

                        editor
                            .edit( table.row( { selected: true } ).index() ,false);

                        // var isOff = editor.get('propertyState');
                        // if(propertyState!=0){
                        //     alert("当前资产状态不是待审核状态，不能撤销！");
                        //     return false;
                        // }
                        editor.set('is_off', '1');
                        editor.submit();

                    }
                }
            ]

        });

    } else if (type == 8) {
        $("#officeComDiv").show();
        var editor= new $.fn.dataTable.Editor({
            ajax: {
                edit: {
                    type: 'PUT',
                    url: '/commis/api/officeSupplies/officeSuppliesComEdit?id=_id_'
                },
                remove: {
                    type: 'DELETE',
                    url: '/commis/api/officeSupplies/remove?id=_id_'
                }
            },
            i18n: {
                create: {
                    title: "新增记录",
                    submit: "添加"
                },
                edit: {
                    title: "审批办公经费",
                    submit: "修改",
                    confirm: "您确定要修改这 %d 条记录吗?"
                },
                remove: {
                    title: "删除记录",
                    submit: "删除",
                    confirm: "您确定要删除这 %d 条记录吗?"
                }
            },
            idSrc: 'supplies_id',
            table: "#officeComTable",
            fields: [
                {
                    label: "是否完成:",
                    name: "is_off"

                }]
        });
        editor.on('submitSuccess', function (e, d, action) {

            $.ajax({
                url: '/commis/api/index/notify',
                type: "GET",
                async: false,
                dataType: 'json',
                success: function (result) {
                    if (result.status == 0) {
                        countNotify(result);
                    }


                }, error: function (msg) {
                    alert("发生错误");
                }
            })


        });

        var table=$('#officeComTable').DataTable({
            dom: "Bfrtip",
            ajax: "/commis/api/officeSupplies/officeSuppliesComNotify?isOff=7",

            autoWidth: true,
            responsive: true,
            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    }/*,
                     columns: "选中 %d 列"*/
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community_name', defaultContent: ""
                }, {
                    data: 'supplies_id',
                    render: function (data, type, row) {
                        return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="officeSuppliesDetail.html?id=' + data + '" class="btn btn-primary btn-xs" title="经费详情">经费详情</a></li></ul> </div>';
                    }
                }, {
                    data: 'is_off',
                    render: function (data, type, row) {
                        if(data==1){
                            return '<a href="api/officeSupplies/download/' + row.supplies_id + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/officeSupplies/download/' + row.supplies_id+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'person_name', defaultContent: ""
                }, {
                    data: 'register_time', defaultContent: ""
                }, {
                    data: 'workexp_type', defaultContent: ""
                }, {
                    data: 'sum', defaultContent: ""
                }, /*{
                 data: 'liveAddr', defaultContent: ""
                 },*/ {
                    data: 'payment_mode', defaultContent: ""
                }, {
                    data: 'comment', defaultContent: ""
                }, {
                    data: 'is_off',
                    render: function (data, type, row) {
                        if (1 == data) {
                            return "是";
                        } else {
                            return "否"
                        }
                    }
                }], select: true,
            buttons: [
                {
                    extend: "selectedSingle",
                    text: "确定",
                    className: 'btn btn-primary',
                    action: function ( e, dt, node, config ) {

                        editor
                            .edit( table.row( { selected: true } ).index() ,false);

                        // var isOff = editor.get('propertyState');
                        // if(propertyState!=0){
                        //     alert("当前资产状态不是待审核状态，不能撤销！");
                        //     return false;
                        // }
                        editor.set('is_off', '1');
                        editor.submit();

                    }
                }
            ]
        });

    }else if (type == 9) {
        $("#publicFundComDiv").show();
        var editor = new $.fn.dataTable.Editor({
            ajax: {
                edit: {
                    type: 'PUT',
                    url: '/commis/api/publicFund/publicFundComEdit?id=_id_'
                },
                remove: {
                    type: 'DELETE',
                    url: '/commis/api/publicFund/remove?id=_id_'
                }
            },
            i18n: {
                edit: {
                    title: "审批群众经费",
                    submit: "确定",
                    confirm: "您确定要修改这 %d 条记录吗?"
                },
                remove: {
                    title: "删除记录",
                    submit: "删除",
                    confirm: "您确定要删除这 %d 条记录吗?"
                }
            },
            idSrc: 'pf_id',
            table: "#publicFundComTable",
            fields: [
                {
                    label: "是否完成:",
                    name: "is_off"

                }]
        });
        editor.on('submitSuccess', function (e, d, action) {

            $.ajax({
                url: '/commis/api/index/notify',
                type: "GET",
                async: false,
                dataType: 'json',
                success: function (result) {
                    if (result.status == 0) {

                        countNotify(result);
                    }


                }, error: function (msg) {
                    alert("发生错误");
                }
            })


        });
        var table=$('#publicFundComTable').DataTable({

            dom: "Bfrtip",
            ajax: "/commis/api/publicFund/publicFundComNotify?isOff=7",
            autoWidth: true,
            responsive: true,

            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    },
                    columns: "选中 %d 列"
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community_name', defaultContent: ""
                }, {
                    data: 'pf_id',
                    render: function (data, type, row) {
                        return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="publicFundDetail.html?id=' + data + '" class="btn btn-primary btn-xs" title="群众经费详情">群众经费详情</a></li></ul> </div>';
                    }
                }, {
                    data: 'is_off',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/publicFund/btDownload?filepath1=' + row.attachpath1 + '&filepath2=' + row.attachpath2 + '&filepath3=' + row.attachpath3+'" class="btn btn-primary btn-xs" >打包下载</a>';

                        }else{
                            return '<a href="api/publicFund/btDownload?filepath1=' + row.attachpath1 + '&filepath2=' + row.attachpath2 + '&filepath3=' + row.attachpath3+'" class="btn btn-primary btn-xs" >打包下载</a>';

                        }
                    }
                }, /*{
                 data: 'depart.departName', defaultContent: ""
                 },*/ {
                    data: 'person_name', defaultContent: ""
                }, {
                    data: 'register_time', defaultContent: ""
                }, {
                    data: 'pf_title', defaultContent: ""

                }, {
                    data: 'pf_time', defaultContent: ""
                }, {
                    data: 'attachpath1',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/publicFund/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/publicFund/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'attachpath2',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/publicFund/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/publicFund/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'attachpath3',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/publicFund/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/publicFund/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'isOff',
                    render: function (data, type, row) {
                        if (1 == data) {
                            return "是";
                        } else {
                            return "否"
                        }
                    }
                }],
            select: true,
            buttons: [
                {
                    extend: "selectedSingle",
                    text: "确定",
                    className: 'btn btn-primary',
                    action: function ( e, dt, node, config ) {

                        editor
                            .edit( table.row( { selected: true } ).index() ,false);

                        // var isOff = editor.get('propertyState');
                        // if(propertyState!=0){
                        //     alert("当前资产状态不是待审核状态，不能撤销！");
                        //     return false;
                        // }
                        editor.set('is_off', '1');
                        editor.submit();

                    }
                }
            ]

        });

    }  else if (type == 10) {
        $("#constructionComDiv").show();
        var editor = new $.fn.dataTable.Editor({
            ajax: {
                edit: {
                    type: 'PUT',
                    url: '/commis/api/construction/constructionComEdit?id=_id_'
                },
                remove: {
                    type: 'DELETE',
                    url: '/commis/api/construction/remove?id=_id_'
                }
            },
            i18n: {
                edit: {
                    title: "审批群众经费",
                    submit: "确定",
                    confirm: "您确定要修改这 %d 条记录吗?"
                },
                remove: {
                    title: "删除记录",
                    submit: "删除",
                    confirm: "您确定要删除这 %d 条记录吗?"
                }
            },
            idSrc: 'con_id',
            table: "#constructionComTable",
            fields: [
                {
                    label: "是否完成:",
                    name: "is_off"

                }]
        });
        editor.on('submitSuccess', function (e, d, action) {

            $.ajax({
                url: '/commis/api/index/notify',
                type: "GET",
                async: false,
                dataType: 'json',
                success: function (result) {
                    if (result.status == 0) {

                        countNotify(result);
                    }


                }, error: function (msg) {
                    alert("发生错误");
                }
            })


        });
        var table=$('#constructionComTable').DataTable({

            dom: "Bfrtip",
            ajax: "/commis/api/construction/constructionComNotify?isOff=7",
            autoWidth: true,
            responsive: true,

            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    },
                    columns: "选中 %d 列"
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community_name', defaultContent: ""
                }, {
                    data: 'con_id',
                    render: function (data, type, row) {
                        return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="constructionDetail.html?id=' + data + '" class="btn btn-primary btn-xs" title="群众经费详情">党建经费详情</a></li></ul> </div>';
                    }
                }, {
                    data: 'is_off',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/construction/btDownload?filepath1=' + row.attachpath1 + '&filepath2=' + row.attachpath2 + '&filepath3=' + row.attachpath3+'" class="btn btn-primary btn-xs" >打包下载</a>';

                        }else{
                            return '<a href="api/construction/btDownload?filepath1=' + row.attachpath1 + '&filepath2=' + row.attachpath2 + '&filepath3=' + row.attachpath3+'" class="btn btn-primary btn-xs" >打包下载</a>';

                        }
                    }
                }, /*{
                 data: 'depart.departName', defaultContent: ""
                 },*/ {
                    data: 'person_name', defaultContent: ""
                }, {
                    data: 'register_time', defaultContent: ""
                }, {
                    data: 'con_title', defaultContent: ""

                }, {
                    data: 'con_time', defaultContent: ""
                }, {
                    data: 'attachpath1',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/construction/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/construction/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'attachpath2',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/construction/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/construction/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'attachpath3',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/construction/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/construction/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'isOff',
                    render: function (data, type, row) {
                        if (1 == data) {
                            return "是";
                        } else {
                            return "否"
                        }
                    }
                }],
            select: true,
            buttons: [
                {
                    extend: "selectedSingle",
                    text: "确定",
                    className: 'btn btn-primary',
                    action: function ( e, dt, node, config ) {

                        editor
                            .edit( table.row( { selected: true } ).index() ,false);

                        // var isOff = editor.get('propertyState');
                        // if(propertyState!=0){
                        //     alert("当前资产状态不是待审核状态，不能撤销！");
                        //     return false;
                        // }
                        editor.set('is_off', '1');
                        editor.submit();

                    }
                }
            ]

        });

    }else if (type == 11) {
        $("#publicFundOrgDiv").show();
        var editor = new $.fn.dataTable.Editor({
            ajax: {
                edit: {
                    type: 'PUT',
                    url: '/commis/api/publicFund/publicFundComEdit?id=_id_'
                },
                remove: {
                    type: 'DELETE',
                    url: '/commis/api/publicFund/remove?id=_id_'
                }
            },
            i18n: {
                edit: {
                    title: "审批群众经费",
                    submit: "确定",
                    confirm: "您确定要修改这 %d 条记录吗?"
                },
                remove: {
                    title: "删除记录",
                    submit: "删除",
                    confirm: "您确定要删除这 %d 条记录吗?"
                }
            },
            idSrc: 'pf_id',
            table: "#publicFundOrgTable",
            fields: [
                {
                    label: "是否完成:",
                    name: "is_off"

                }]
        });
        editor.on('submitSuccess', function (e, d, action) {

            $.ajax({
                url: '/commis/api/index/notify',
                type: "GET",
                async: false,
                dataType: 'json',
                success: function (result) {
                    if (result.status == 0) {

                        countNotify(result);
                    }


                }, error: function (msg) {
                    alert("发生错误");
                }
            })


        });
        var table=$('#publicFundOrgTable').DataTable({

            dom: "Bfrtip",
            ajax: "/commis/api/publicFund/publicFundOrgNotify?isOff=6",
            autoWidth: true,
            responsive: true,

            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    },
                    columns: "选中 %d 列"
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community_name', defaultContent: ""
                }, {
                    data: 'pf_id',
                    render: function (data, type, row) {
                        return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="publicFundDetail.html?id=' + data + '" class="btn btn-primary btn-xs" title="群众经费详情">群众经费详情</a></li></ul> </div>';
                    }
                }, {
                    data: 'is_off',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/publicFund/btDownload?filepath1=' + row.attachpath1 + '&filepath2=' + row.attachpath2 + '&filepath3=' + row.attachpath3+'" class="btn btn-primary btn-xs" >打包下载</a>';

                        }else{
                            return '<a href="api/publicFund/btDownload?filepath1=' + row.attachpath1 + '&filepath2=' + row.attachpath2 + '&filepath3=' + row.attachpath3+'" class="btn btn-primary btn-xs" >打包下载</a>';

                        }
                    }
                }, /*{
                 data: 'depart.departName', defaultContent: ""
                 },*/ {
                    data: 'person_name', defaultContent: ""
                }, {
                    data: 'register_time', defaultContent: ""
                }, {
                    data: 'pf_title', defaultContent: ""

                }, {
                    data: 'pf_time', defaultContent: ""
                }, {
                    data: 'attachpath1',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/publicFund/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/publicFund/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'attachpath2',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/publicFund/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/publicFund/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'attachpath3',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/publicFund/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/publicFund/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'isOff',
                    render: function (data, type, row) {
                        if (1 == data) {
                            return "是";
                        } else {
                            return "否"
                        }
                    }
                }],
            select: true,
            buttons: [
                {
                    extend: "selectedSingle",
                    text: "确定",
                    className: 'btn btn-primary',
                    action: function ( e, dt, node, config ) {

                        editor
                            .edit( table.row( { selected: true } ).index() ,false);

                        // var isOff = editor.get('propertyState');
                        // if(propertyState!=0){
                        //     alert("当前资产状态不是待审核状态，不能撤销！");
                        //     return false;
                        // }
                        editor.set('is_off', '7');
                        editor.submit();

                    }
                }
            ]

        });

    }  else if (type == 12) {
        $("#constructionOrgDiv").show();
        var editor = new $.fn.dataTable.Editor({
            ajax: {
                edit: {
                    type: 'PUT',
                    url: '/commis/api/construction/constructionComEdit?id=_id_'
                },
                remove: {
                    type: 'DELETE',
                    url: '/commis/api/construction/remove?id=_id_'
                }
            },
            i18n: {
                edit: {
                    title: "审批群众经费",
                    submit: "确定",
                    confirm: "您确定要修改这 %d 条记录吗?"
                },
                remove: {
                    title: "删除记录",
                    submit: "删除",
                    confirm: "您确定要删除这 %d 条记录吗?"
                }
            },
            idSrc: 'con_id',
            table: "#constructionOrgTable",
            fields: [
                {
                    label: "是否完成:",
                    name: "is_off"

                }]
        });
        editor.on('submitSuccess', function (e, d, action) {

            $.ajax({
                url: '/commis/api/index/notify',
                type: "GET",
                async: false,
                dataType: 'json',
                success: function (result) {
                    if (result.status == 0) {

                        countNotify(result);
                    }


                }, error: function (msg) {
                    alert("发生错误");
                }
            })


        });
        var table=$('#constructionOrgTable').DataTable({

            dom: "Bfrtip",
            ajax: "/commis/api/construction/constructionOrgNotify?isOff=6",
            autoWidth: true,
            responsive: true,

            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    },
                    columns: "选中 %d 列"
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community_name', defaultContent: ""
                }, {
                    data: 'con_id',
                    render: function (data, type, row) {
                        return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="constructionDetail.html?id=' + data + '" class="btn btn-primary btn-xs" title="群众经费详情">党建经费详情</a></li></ul> </div>';
                    }
                }, {
                    data: 'is_off',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/construction/btDownload?filepath1=' + row.attachpath1 + '&filepath2=' + row.attachpath2 + '&filepath3=' + row.attachpath3+'" class="btn btn-primary btn-xs" >打包下载</a>';

                        }else{
                            return '<a href="api/construction/btDownload?filepath1=' + row.attachpath1 + '&filepath2=' + row.attachpath2 + '&filepath3=' + row.attachpath3+'" class="btn btn-primary btn-xs" >打包下载</a>';

                        }
                    }
                }, /*{
                 data: 'depart.departName', defaultContent: ""
                 },*/ {
                    data: 'person_name', defaultContent: ""
                }, {
                    data: 'register_time', defaultContent: ""
                }, {
                    data: 'con_title', defaultContent: ""

                }, {
                    data: 'con_time', defaultContent: ""
                }, {
                    data: 'attachpath1',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/construction/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/construction/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'attachpath2',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/construction/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/construction/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'attachpath3',
                    render: function (data, type, row) {
                        if(row.isOff==1){
                            return '<a href="api/construction/download?filepath=' + data + '" class="btn btn-primary btn-xs" >下载</a>';

                        }else{
                            return '<a href="api/construction/download?filepath=' + data+ '" class="btn btn-primary btn-xs" >下载</a>';
                        }
                    }
                }, {
                    data: 'isOff',
                    render: function (data, type, row) {
                        if (1 == data) {
                            return "是";
                        } else {
                            return "否"
                        }
                    }
                }],
            select: true,
            buttons: [
                {
                    extend: "selectedSingle",
                    text: "确定",
                    className: 'btn btn-primary',
                    action: function ( e, dt, node, config ) {

                        editor
                            .edit( table.row( { selected: true } ).index() ,false);

                        // var isOff = editor.get('propertyState');
                        // if(propertyState!=0){
                        //     alert("当前资产状态不是待审核状态，不能撤销！");
                        //     return false;
                        // }
                        editor.set('is_off', '7');
                        editor.submit();

                    }
                }
            ]

        });

    }else  if (type == 13) {
        $("#attDiv").show();
        $('#attTable').DataTable({

            ajax: "/commis/api/attendance/pageNotifyDatatables?flag=2",
            autoWidth: true,
            responsive: true,

            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    },
                    columns: "选中 %d 列"
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community_name', defaultContent: ""
                },
                {
                    data: 'year', defaultContent: ""
                },
                {
                    data: 'month', defaultContent: ""
                }, {
                    data: 'year',
                    render: function (data, type, row) {


                            return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="attendance.html?year=' + row.year+ '&month=' + row.month + '&communityId=' + row.community_id + '" class="btn btn-primary btn-xs" title="查看考勤详情">查看考勤详情</a></li></ul> </div>';






                    }
                }
            ]

        });

    }else  if (type == 14) {
        $("#overtimeDiv").show();
        $('#overtimeTable').DataTable({

            ajax: "/commis/api/overtime/pageNotifyDatatables?flag=2",
            autoWidth: true,
            responsive: true,

            serverSide: true,
            processing: true,
            lengthChange: false,//是否允许用户改变表格每页显示的记录数
            ordering: false,//是否允许用户排序
            paging: true,//是否分页
            pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
            searching: false,//是否开始本地搜索
            stateSave: false,//刷新时是否保存状态
            autoWidth: true,//自动计算宽度
            language: {
                emptyTable: "没有数据",
                search: "搜索:",
                paginate: {
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"

                },
                select: {
                    rows: {
                        _: "选中 %d 行",
                        1: "选中 1 行"
                    },
                    columns: "选中 %d 列"
                },
                lengthMenu: "每页 _MENU_ 条记录",
                zeroRecords: "没有找到记录",
                info: "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )，共 _TOTAL_ 项",
                infoEmpty: "无记录",
                infoFiltered: "(从 _MAX_ 条记录过滤)"
            },
            columns: [
                {
                    data: 'community_name', defaultContent: ""
                },
                {
                    data: 'year', defaultContent: ""
                },
                {
                    data: 'month', defaultContent: ""
                }, {
                    data: 'year',
                    render: function (data, type, row) {


                        return '<div class="operating_style Quick_operation"> <ul> <li class="submenu"><a name="overtime.html?year=' + row.year+ '&month=' + row.month + '&communityId=' + row.community_id + '" class="btn btn-primary btn-xs" title="查看加班详情">查看加班详情</a></li></ul> </div>';






                    }
                }
            ]

        });

    }else {


        alert("发生错误");

    }


    /*    if (userTypeId == 2) {
     $("#leadDiv").remove();
     $("#proDiv").show();
     } else if (userTypeId == 3) {
     $("#leadDiv").show();
     $("#proDiv").remove();
     }*/


});


$(function () {
    $("#page_style").frame({
        float: 'left',
        menu_nav: '.table',
        color_btn: '.skin_select',
        Sellerber_menu: '.list_content',
        Sellerber_header: '.Sellerber_header',
    });
});
$("#iframe_box").niceScroll({
    cursorcolor: "#888888",
    cursoropacitymax: 1,
    touchbehavior: false,
    cursorwidth: "5px",
    cursorborder: "0",
    cursorborderradius: "5px"
});

require.config({
    paths: {
        echarts: './js/dist'
    }
});
	
